package cn.com.open.itembank.common.enums;

/**
 * Created by lucky on 2017/9/27.
 */

/**
 * 数据类型：0，试题；1，试卷
 */
public enum SourceType {
    /**
     * 试题录入（默认）
     */
    QUESTION(0),
    /**
     * 试卷录入
     */
    TESTPAPER(1);

    private Integer index;

    SourceType(Integer idx) {
        this.index = idx;
    }

    /**
     * Gets index.
     *
     * @return the index
     */
    public Integer getIndex() {
        return index;
    }

    /**
     * From value check type.
     *
     * @param v the v
     * @return the check type
     */
    public static SourceType fromValue(Integer v) {
        for (SourceType c : SourceType.values()) {
            if (c.getIndex() == v) {
                return c;
            }
        }
        return null;
    }
}
